﻿// Inner Fire 游戏引擎库
// 渲染项目类-基类
//
// Copyright (c) 2024 by 尔西大帝. All rights reserved.
//
// 所有的RenderItem类都需要继承此类
//
// Author: 尔西大帝
// Email: 2670613871@qq.com
// Created: 2024-12-21

#include "basic_render_item.h"
#include <dx/core/dx_utils.h>
#include <enum_parser.h>
#include <static_string.h>

namespace ifire::dx {

BasicRenderItem::BasicRenderItem()
    : instanced_id(DxUtils::ObtainInstancedId()) {
}

RenderLayer BasicRenderItem::GetRenderLayer(ikit::sstr name) {
  const static std::pair<ikit::sstr, RenderLayer> RENDER_LAYER_ENUMS[] = {
      {"Opaque", RenderLayer::Opaque},                         //
      {"SkinnedOpaque", RenderLayer::SkinnedOpaque},           //
      {"Transparent", RenderLayer::Transparent},               //
      {"SkinnedTransparent", RenderLayer::SkinnedTransparent}, //
      {"AlphaTest", RenderLayer::AlphaTest},                   //
      {"SkinnedAlphaTest", RenderLayer::SkinnedAlphaTest},     //
      {"SkyBox", RenderLayer::SkyBox},                         //
      {"Tree", RenderLayer::Tree},                             //
      {"GpuWaves", RenderLayer::GpuWaves},                     //
      {"UI", RenderLayer::UI},                                 //
      {"Debug", RenderLayer::Debug}                            //
  };
  static ikit::EnumParser<RenderLayer> renderLayerParser(
      RENDER_LAYER_ENUMS, (int)RenderLayer::Count);

  return renderLayerParser.Get(name, RenderLayer::Opaque);
}

} // namespace ifire::dx